package uk.co.douglashoskins.weathercompare;

import java.util.Vector;

public class ScreenStack {
	private Vector screens = new Vector();
	
	private static ScreenStack instance;
	public static ScreenStack getInstance() {
		if (instance == null) {
			instance = new ScreenStack();
		}
		return instance;
	}
	
	public void push(Screen s) {
		screens.addElement(s);
		WeatherCompare.c.repaint();
	}
	
	public void pop() {
		if (screens.size() > 0) {
			screens.removeElementAt(screens.size() - 1);
		}
		WeatherCompare.c.repaint();
	}
	
	protected Screen getTopScreen() {
		if (screens.size() > 0) {
			return (Screen)screens.elementAt(screens.size() - 1);
		}
		
		return null;
	}
}
